﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Provenance.Domain.Breed;
using Provenance.ErrorCount;
using Provenance.Read.Api.Application.Command.Breed;

namespace Provenance.Read.Api.Controllers
{
    [Route("api/breed/[controller]/[action]")]
    [ApiController]
    public class BreedController : ControllerBase
    {
        private readonly IMediator _mediator;
        public BreedController(IMediator mediator)
        {
            _mediator = mediator;
        }
        [HttpGet]
        public async Task<ApiResult<BreedingInfo>> BackBreedInfo([FromQuery]int Pid)
        {
            return await _mediator.Send(new BackBreedInfoCommand()
            {
                ProductInfoId = Pid
            });
        }
        [HttpGet]
        public async Task<ApiResult<IList<BreedHealth>>> GetBreedHealth([FromQuery]GetBreedHealthCommand param)
        {
            return await _mediator.Send(param);
        }
        [HttpGet]
        public async Task<ApiResult<BreedHealth>> BackBreedHealth([FromQuery]int Pid)
        {
            return await _mediator.Send(new BackBreedHealthCommand()
            {
                ProductInfoId = Pid
            });
        }
        [HttpGet]
        public async Task<ApiResult<BreedEnterprise>> BackBreedEnterprise([FromQuery]int Pid)
        {
            return await _mediator.Send(new BackBreedEnterpriseCommand()
            {
                ProductInfoId = Pid
            });
        }


    }
}
